/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fwdisp.net.events;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import network.events.Event;
import network.events.StatusEvent;
import network.version.VersionInfo;

/**
 *
 * @author rbs
 */
public class EventServer{

    ArrayList<EventListener> listeners;
    
    ServerSocket server;
    
    public EventServer() throws IOException, ClassNotFoundException {
        
        server = new ServerSocket(112001);
        
        while(true)
        {
            Socket client = server.accept();
                ObjectInputStream input = new ObjectInputStream(client.getInputStream());
                ObjectOutputStream output = new ObjectOutputStream(client.getOutputStream());
                output.writeObject(new VersionInfo());
                
                Event event = (Event) input.readObject();
        }
    }
    
    private void throwEvent(Event event)
    {
        for (EventListener listener: listeners)
        {
            
        }
    }
    
    public void addEventListener(EventListener listener)
    {
        this.listeners.add(listener);
    }
    
    
}
